<?php
allowCors();
if (!methodsRequired(['get'])) return;
if (!checkAdmin($msg)) return;

if (isset($_REQUEST['dept_id'])) {
    $department = new Department();
    if ($db->query($department, ["name" => "dept_id", "value" => $_REQUEST['dept_id']])) {
        $msg->data = json_decode($department->__toString());
    } else {
        $msg->setCode(4);
    }
} else {
    $msg->setCode(4);
}

echo $msg;
